package com.yang.springcloudalibaba.controller;

import com.yang.springcloud.service.MenuClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class MenuConsumerController {

    @Autowired
    MenuClientService menuClientService;

    @PostMapping("/consumer/menu/queryMenu")
    public Map<String, Object> queryMenu(@RequestParam(name = "menuid") int menuid){
        return menuClientService.queryMenu(menuid);
    }

    @PostMapping("/consumer/menu/queryRoleMenu")
    public Map<String, Object> queryRoleMenu(@RequestParam(name = "menuid") int menuid, @RequestParam(name = "roleid") int roleid){
        return menuClientService.queryRoleMenu(menuid, roleid);
    }

    @PostMapping("/consumer/menu/insertRoleMenu")
    public Map<String, Object> insertRoleMenu(@RequestParam(name = "roleid") int roleid, @RequestParam(name = "menu") String menuStr){
        return menuClientService.insertRoleMenu(roleid, menuStr);
    }

}
